<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">车展场租费用</div>
  <table class="table table-bordered">
    <thead>
      <tr>
        <th class="bg-primary text-center">场租单价（元/㎡）</th>
        <th class="bg-primary text-center">场租面积（日产+启辰）(㎡)</th>
        <th class="bg-primary text-center">场租预计总额</th>
        <th class="bg-primary text-center">场租实际总额</th>
        <th class="bg-primary text-center">参展专营店数量（不含启辰店）</th>
        <th class="bg-primary text-center">单个专营店场租出资上限</th>
        <th class="bg-primary text-center">参展专营店实际出资总额</th>
        <th class="bg-primary text-center">启辰店实际出资总额</th>
        <th class="bg-primary text-center"><span data-toggle="tooltip" data-placement="top" title="RMP支持场租费用=场租总额-专营店出资总额-启辰店出资总额">RMP支持场租费用</span><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></th>
        <th class="bg-primary text-center">自证照片</th>
        <th class="bg-primary text-center">结算审核结果</th>
        <?php if (in_array($action, array('audit'))) {?>
        <th class="bg-primary text-center">操作</th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
    <?php foreach($rentList as $k => $v): ?>
      <tr>
        <td class="text-center"><?php echo $v['unitPrice']; ?></td>
        <td class="text-center"><?php echo $v['areaSize'] ?></td>
        <td class="text-center"><?php echo $v['budgetApply'] ?></td>
        <td class="text-center">
          <?php if (in_array($action, array('edit'))) {?>
            <?php if (in_array($v['settleAuditRs'], array(-1,0,3)) ) {?>
            <input type="number" style="width: 100px;" required min="0" step="0.01" class="form-control" style="width: 100px;" id="rent[<?=$v['id']?>][settleApply]" name="rent[<?=$v['id']?>][settleApply]" value="<?=(float)$v['settleApply']?$v['settleApply']:$v['budgetAudit']?>" placeholder="实际费用">
            <input type="hidden" id="rent[<?=$v['id']?>][isSettle]" name="rent[<?=$v['id']?>][isSettle]" value="1">
            <?php }else{echo $v['settleApply'];} ?>
          <?php } ?>
          <?php
          if (in_array($action, array('audit','check'))) {
            echo $v['settleApply'];
          }
          ?>
          <?php if (in_array($action, array('change'))) {?>
            <input type="number" style="width: 100px;" required min="0" step="0.01" class="form-control" style="width: 100px;" id="rent[<?=$v['id']?>][settleApply]" name="rent[<?=$v['id']?>][settleApply]" value="<?=(float)$v['settleApply']?$v['settleApply']:$v['budgetAudit']?>" placeholder="实际费用">
            <input type="hidden" name="rent[<?=$v['id']?>][settleAuditRs]" id="rent[<?=$v['id']?>][settleAuditRs]" value="<?=$v['settleAuditRs']?>">
          <?php } ?>
        </td>
        <td class="text-center"><?php echo $v['storeNum'] ?></td>
        <td class="text-center"><?php echo $v['oneStorePrice'] ?></td>
        <td class="text-center"><?php echo $v['settleStoreTotal'] ?></td>
        <td class="text-center">
          <?php if (in_array($action, array('edit')) && in_array($v['settleAuditRs'], array(-1,0,3)) ) {?>
          <select class="form-control" style="width: 100px;" placeholder=".col-xs-4" id="settleQiTotalType" name="rent[<?=$v['id']?>][settleQiTotalType]">
            <option value="">请选择</option>
          </select>
          <input type="input" class="form-control" style="width: 100px;" name="rent[<?=$v['id']?>][settleQiTotal]" id="settleQiTotal" value="<?=$v['settleQiTotal']?>" placeholder="启辰店实际出资总额">
          <?php }else{echo $v['settleQiTotal'];} ?>
        </td>
        <td class="text-center"><?php echo $v['settleRmpSupport'] ?></td>
        <td class="text-center col-sm-2">
            <div id="rentUpload<?=$v['id']?>ImgBox" style="width:200px;overflow:hidden;">
              <?php if ($v['fileData']) {?>
              <a target="_blank" href="<?=$v['fileData']['viewPath']?>" class="thumbnail">
                <img class="carousel-inner img-responsive img-rounded" src="<?=$v['fileData']['viewPath']?>">
              </a>
              <?php } ?>
            </div>
            <?php if (in_array($action, array('edit')) && in_array($v['settleAuditRs'], array(-1,0,3))) { ?>
            <input type="hidden" id="rentUpload<?=$v['id']?>FileId" name="rent[<?=$v['id']?>][fileId]" value="<?=$v['fileId']?>" readonly="readonly">
            <input type="button" id="rentUpload<?=$v['id']?>" value="上传" />
            <?php
              $rentButtonIds[] = 'rentUpload'.$v['id'];
            }
            ?>
        </td>
        <td class="text-center"><?php echo $v['settleAuditStr'] ?></td>
        <?php if (in_array($action, array('audit'))) {?>
        <td class="text-center">
          <?php
          $options = $this->config->item('settleAuditOptions');
          $extra = ' class="form-control" style="width:70px;" '.($this->user['userRole']>=$v['settleAuditRole']?'':'disabled');
          echo form_dropdown('rent['.$v['id'].'][settleAuditRs]', $options, $v['settleAuditRs'], $extra);
          ?>
        </td>
        <?php } ?>
      </tr>
    <?php endforeach; ?>
    </tbody>
  </table>
</div>
<script type="text/javascript" src="public/js/commonCarshow.js"></script>
<script type="text/javascript">
$(function(){
  $('[data-toggle="tooltip"]').tooltip();
  <?php foreach($rentList as $k => $v){ ?>
  loadCarshowQiTotalType('settleQiTotalType',<?=isset($v['settleQiTotalType']) ? $v['settleQiTotalType'] : 0?>);
  qiTotalTypeDisplay('settleQiTotal',<?=isset($v['settleQiTotalType']) ? $v['settleQiTotalType'] : 0?>);
  <?php } ?>
  $("#settleQiTotalType").change(function(){
    qiTotalTypeDisplay('settleQiTotal',this.value);
  });
});
</script>
<?php initUploadButtons($rentButtonIds, printUrl('Upload','uploadSave',array('dir'=>'image')), 'imgFile'); ?>